package kr.saeildadim.androidexam_saeildamil.chapter16;

import kr.saeildadim.androidexam_saeildamil.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.PopupWindow;

public class Ch16_Popup extends Activity {
	PopupWindow popup;
	View popupview;
	LinearLayout linear;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch16_popup);
		
		linear = (LinearLayout) findViewById(R.id.ch16_pupup_linear);
		popupview = View.inflate(this, R.layout.ch16_popupview,  null);
		popup = new PopupWindow(popupview, 200, 150, true);
		
		final Button btnshow = (Button) findViewById(R.id.ch16_popup_showbtn);
		btnshow.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				popup.showAtLocation(linear, Gravity.NO_GRAVITY, 100, 150);
				
				
				
			}
		});
		Button btnclose = (Button) popupview.findViewById(R.id.ch16_popup_close_btn);
		btnclose.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				popup.dismiss();
				
			}
		});
	}
	
}
